package com.xhwl.logistics.controller;

import com.xhwl.common.pojo.ResultJson;
import com.xhwl.logistics.enums.VehicleCarTypeEnum;
import com.xhwl.logistics.vo.VehicleCarTypeVO;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

//@RestController
public class VehicleCarTypeController {

    @GetMapping("/car-type/list")
    public ResultJson<List<VehicleCarTypeVO>> carType() {
        List<VehicleCarTypeVO> vehicleCarTypeVOList = Stream.of(VehicleCarTypeEnum.values())
                .map(vehicleCarTypeEnum -> new VehicleCarTypeVO(vehicleCarTypeEnum.getDescription()))
                .collect(Collectors.toList());
        return ResultJson.successWithResult(vehicleCarTypeVOList);
    }

}
